package People;

import Config.Config;

/**
 * Models an person inheriting of People
 * 
 * @author Amir BEN SLIMANE
 */
public class Person extends People {
	private boolean isVaccinated;
	private int fitnessLevel;

	/**
	 * Builder's Person
	 * 
	 * @param status 
	 * @param isVaccinated
	 * @param fitnessLevel
	 */
	public Person(Status status, boolean isVaccinated, int fitnessLevel) {
		super(status);
		this.sexe = sexeRandom();
		this.setFitnessLevel(fitnessLevel);
		this.setVaccinated(isVaccinated);
		this.infectionRate = infectionRateCalcul(isVaccinated, fitnessLevel);
	}

	/**
	 * Calculates the infection rate
	 * 
	 * @param isVaccinated
	 * @param fitnessLevel
	 * @return infectionRate
	 */
	private int infectionRateCalcul(boolean isVaccinated, int fitnessLevel) {
		if (this.isVaccinated()) {
			return 0;
		} else {
			if (this.sexe == Sexe.Male) {
				return (int) (Config.INFECTION_RATE_MALE / (1 + 2 * this.fitnessLevel / 15));
			} else {
				return (int) (Config.INFECTION_RATE_FEMALE / (1 + 2 * this.fitnessLevel / 15));
			}
		}
	}

	/**
	 * @return the isVaccinated
	 */
	public boolean isVaccinated() {
		return isVaccinated;
	}

	/**
	 * @param isVaccinated the isVaccinated to set
	 */
	public void setVaccinated(boolean isVaccinated) {
		this.isVaccinated = isVaccinated;
	}

	/**
	 * @return the fitnessLevel
	 */
	public int getFitnessLevel() {
		return fitnessLevel;
	}

	/**
	 * @param fitnessLevel the fitnessLevel to set
	 */
	public void setFitnessLevel(int fitnessLevel) {
		this.fitnessLevel = fitnessLevel;
	}

	
}
